<template>
	<view>
		<view style="padding: 10px;" class="box">
			<view style="display: flex;">
				<image src="../../static/icons/信息.png" style="width: 30px;border-radius: 50%;" mode="widthFix">
					<view style="font-size: 14px;font-weight: bold;margin-top: 4px;">基本信息</view>
			</view>
			<view style="margin-top: 10px;">
				<view style="display: flex;margin-top: 10px;">
					<view style="flex: 3;">用户名称</view>
					<view style="flex: 2; color:gray;">{{recordData.userName}}</view>
				</view>
				<view style="display: flex;margin-top: 10px;">
					<view style="flex: 3;">就诊人</view>
					<view style="flex: 2; color:gray;">{{recordData.patientName}}</view>
				</view>
				<view style="display: flex;margin-top: 10px;">
					<view style="flex: 3;">医疗机构</view>
					<view style="flex: 2; color:gray;">{{recordData.hospitalName}}</view>
				</view>
				<view style="display: flex;margin-top: 10px;">
					<view style="flex: 3;">就诊医生</view>
					<view style="flex: 2; color:gray;">{{recordData.doctorName}}</view>
				</view>
				<view style="display: flex;margin-top: 10px;">
					<view style="flex: 3;">就诊科室</view>
					<view style="flex: 2; color:gray;">{{recordData.officeName}}</view>
				</view>
				<view style="display: flex;margin-top: 10px;">
					<view style="flex: 3;">就诊时间</view>
					<view style="flex: 2; color:gray;">{{recordData.recordData}}
					</view>
				</view>
			</view>
		</view>
		<view style="padding: 10px;margin-top: 10px;" class="box">
			<view style="display: flex;">
				<image src="../../static/icons/信息.png" style="width: 30px;border-radius: 50%;" mode="widthFix">
					<view style="font-size: 14px;font-weight: bold;margin-top: 4px;">病例信息</view>
			</view>
			<view style="margin-top: 20px;">
				<view style="display: flex;margin-top: 10px;gap: 20px;">
					<view style="flex: 1;font-size: 16px;">病情详细描述</view>
					<view style="flex: 6; color:gray;">{{medicalData.diseaseDescription }}</view>
				</view>
				<view style="display: flex;margin-top: 10px;gap: 30px;">
					<view style="flex: 1;font-size: 16px;">医生嘱咐</view>
					<view style="flex: 8; color:gray;">
						{{medicalData.doctorTalk}}
					</view>
				</view>
				<view style="display: flex;margin-top: 10px;gap: 30px;">
					<view style="flex: 1;font-size: 16px;">治疗方案</view>
					<view style="flex: 8; color:gray;">
						{{medicalData.treatmentPlan}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				recordData: {},
				medicalData: {},
			}
		},
		onLoad(option) {
			this.recordId = option.recordId;
		},
		onShow() {
			this.load()
			this.lookMedical()
		},
		methods: {
			load() {
				this.$request.get(`/record/selectById/${this.recordId}`).then(res => {
					if (res.code === '200') {
						this.recordData = res.data;
					} else {
						this.$message.error(res.msg);
					}
				});
			},
			lookMedical() {
				this.$request.get(`/medicalCard/selectByRecordId/${this.recordId}`).then(res => {
					if (res.code === '200') {
						this.medicalData = res.data; // 直接将res.data赋值给this.form
					} else {
						this.$message.error(res.msg);
					}
				});
			},
		},
	}
</script>

<style>

</style>